<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>教师界面|成绩查询</title>
		<link rel="stylesheet" type="text/css" href="css/identify.css" />
		<link rel="stylesheet" type="text/css" href="css/layout.css" />
		<link rel="stylesheet" type="text/css" href="css/account.css" />
		<link rel="stylesheet" type="text/css" href="css/style.css" />
		<link rel="stylesheet" type="text/css" href="css/control_index.css" />
		<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="js/layer/layer.js"></script>
		<script type="text/javascript" src="js/haidao.offcial.general.js"></script>
		<script type="text/javascript" src="js/select.js"></script>
		<script type="text/javascript" src="js/haidao.validate.js"></script>
	
	</head>

	<body>
		<div class="view-topbar">
			<div class="topbar-console">
				<div class="tobar-head fl">

					<a href="teacher_info.html" class="topbar-home-link topbar-btn text-center fl" style="width: 180px; border-right: 1px solid #008fbf;"><span>教师端|教师管理界面</span></a>
				</div>
			</div>
			<div class="topbar-info">
				<ul class="fr">

					<li class="fl topbar-info-item">
					<div class="dropdown">
						<a href="#" class="topbar-btn">
						<span class="fl text-normal" id="username">李老师</span>
						<span class="icon-arrow-down"></span>
						</a>
						<ul class="dropdown-menu">
							<li><a href="login.html" >退出</a></li>
						</ul>
					</div>
					</li>
				</ul>
			</div>
		</div>
		<div class="view-body">
			<div class="view-sidebar">
				<div class="sidebar-content">
					<div class="sidebar-nav">
						<div class="sidebar-title">
							<a href="#">
								<span class="icon"><b class="fl icon-arrow-down"></b></span>
								<span class="text-normal">教师信息</span>
							</a>
						</div>
						<ul class="sidebar-trans">
							<li>
								<a href="#" id="link1">
									<b class="sidebar-icon"></b>
									<span class="text-normal">个人信息</span>
								</a>
							</li>
							<li>
								<a href="#" id="link2">
									<b class="sidebar-icon"></b>
									<span class="text-normal">修改密码</span>
								</a>
							</li>

						</ul>
					</div>
					<div class="sidebar-nav">
						<div class="sidebar-title">
							<a href="#">
								<span class="icon"><b class="fl icon-arrow-down"></b></span>
								<span class="text-normal">学生成绩管理</span>
							</a>
						</div>
						<ul class="sidebar-trans">
							<li>
								<a  href="#" id="link3">
									<b class="sidebar-icon"></b>
									<span class="text-normal">查看教师信息</span>
								</a>
							</li>
							<li>
								<a  href="#" id="link4">
									<b class="sidebar-icon"></b>
									<span class="text-normal">登记学生成绩</span>
								</a>
							</li>
							<li>
								<a  href="#" id="link5">
									<b class="sidebar-icon"></b>
									<span class="text-normal">成绩查询</span>
								</a>
							</li>
							<li>
								<a href="#" id="link6">
									<b class="sidebar-icon"></b>
									<span class="text-normal">成绩分析</span>
								</a>
							</li>
							<li>
								<a href="#" id="link7">
									<b class="sidebar-icon"></b>
									<span class="text-normal">成绩反馈</span>
								</a>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<div class="view-product">
				<div class="authority">
					<div class="authority-head">
						<div class="manage-head">
							<h6 class="layout padding-left manage-head-con">学生成绩查询
							
							</h6>
						</div>
					</div>
						<div class="margin-tb manage-detail-con clearfix">
							<a class="h5 margin-large-left custom fl" href="#" onclick="pro_search()">查询</a>
						</div>
					<div class="authority-content">
						<div class="list-content show">
							<div class="offcial-table tr-border margin-big-top clearfix">
								<div class="tr-th clearfix">
									<div class="th w20">
										姓名
									</div>
									<div class="th w20">
										班级
									</div>
									<div class="th w20">
										java
									</div>
									<div class="th w10">
										python
									</div>
									<div class="th w10">
										Cpp
									</div>
									<div class="th w10">
										CSharp
									</div>
									<div class="th w10">
										总分
									</div>
								</div>
                                    <div class="tr clearfix border-bottom-none" id="elems">
							
						            </div>
								

							</div>
						</div>
						<div class="show-page padding-big-right">
							<div class="page">
								<div class="page">
									<ul class="offcial-page margin-top margin-big-right">
										<li>共<em id="amount" class="margin-small-left margin-small-right">1</em>条数据</li>
										<li>每页显示<em class="margin-small-left margin-small-right">3</em>条</li>
										<li><a href="javascript:void(0)" onclick="lastPage()" class="next disable">上一页</a></li>
										<li></li>
										<li><a href="javascript:void(0)" onclick="nextPage()" class="next disable">下一页</a></li>
										<li><span class="fl">第<em class="margin-small-left margin-small-right" id="pageNum">1</em>页</span></li>
									</ul>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script type="text/javascript">
				
	    </script>	
 <script>
          var str=location.href;
          var numNode=str.indexOf("?");
          var str1=str.substr(numNode+1);
          var username=str1.split("=")[1];
          var text=document.getElementById("username");
          //text.innerHTML=username;
          document.getElementById('link1').href="teacher_info.html"+"?"+"username="+username;
          document.getElementById('link2').href="teacher_repassword.html"+"?"+"username="+username;
          document.getElementById('link3').href="teacher_query_info.html"+"?"+"username="+username;
          document.getElementById('link4').href="teacher_score_input.html"+"?"+"username="+username;
          document.getElementById('link5').href="teacher_query_score.html"+"?"+"username="+username;
          document.getElementById('link6').href="teacher_score_anlysis.html"+"?"+"username="+username;
          document.getElementById('link7').href="teacher_score_feedback.html"+"?"+"username="+username;
 </script>	
	<script>
		var url;
			var funName;
			var stuclass='14级02班';var major='软件工程';
			url="http://localhost:8080/StuScoreSystem/Admin?method=lookoutScores&stuclass=14级02班&major=软件工程";
			myXmlHttpRequest=getXmlHttpObject();
			funName=progress_amount;
			var total_amount;
			var pageNum=1;
			postrequest(url,funName);
			
			function getXmlHttpObject(){
				var xmlHttpRequest;
				if(window.ActiveXObject){
				}else{
					xmlHttpRequest=new XMLHttpRequest();
				}
				return xmlHttpRequest;
			}
			
			
			function postrequest(url,funName){
				if(myXmlHttpRequest){		
					myXmlHttpRequest.open("get",url,true);
					myXmlHttpRequest.onreadystatechange=funName;
					myXmlHttpRequest.send(null);
				}
				else{
					window.alert("error");
				}
			}
			
			function progress_amount(){
				var json=myXmlHttpRequest.responseText;
				var json_obj=eval("("+json+")");
				var meta=json_obj.meta;
				if(meta.state=="success"){
					var per=json_obj.data;
					total_amount=per.length;
					var url1="http://localhost:8080/StuScoreSystem/Admin?method=queryScoresbyPage&stuclass="+stuclass+"&major="+major+"&pageNum=1&amount=3";
					var funName1=progress;
					postrequest(url1,funName1);
				}
			}
			
			function progress(){
				if(myXmlHttpRequest.readyState==4){
					var json=myXmlHttpRequest.responseText;
					var json_obj=eval("("+json+")");
					var meta=json_obj.meta;
					if(meta.state=="success"){
						var per=json_obj.data;
						var divBody=document.getElementById("elems");
						divBody.innerHTML='';
						var amount=document.getElementById("amount");
						amount.innerHTML=total_amount;
						document.getElementById("pageNum").innerHTML=pageNum;
						for(var i=0;i<per.length;i++){
							var col1=document.createElement('div');
							col1.className='td w20';
							col1.innerHTML=per[i].stuname;
							divBody.appendChild(col1);
							var col2=document.createElement('div');
							col2.className='td w20';
							col2.innerHTML=per[i].stuclass;
							divBody.appendChild(col2);
							var col3=document.createElement('div');
							col3.className='td w20';
							col3.innerHTML=per[i].java;
							divBody.appendChild(col3);
							var col4=document.createElement('div');
							col4.className='td w10';
							col4.innerHTML=per[i].python;
							divBody.appendChild(col4);
							var col5=document.createElement('div');
							col5.className='td w10';
							col5.innerHTML=per[i].Cpp;
							divBody.appendChild(col5);
							var col6=document.createElement('div');
							col6.className='td w10';
							col6.innerHTML=per[i].CSharp;
							divBody.appendChild(col6);
							var col7=document.createElement('div');
							col7.className='td w10';
							col7.innerHTML=per[i].sum;
							divBody.appendChild(col7);
						}
					}
					else{
						window.alert(meta.message);
					}
				}
			}
			
			function pro_search(){
				stuclass=prompt("请输入查询班级","");
				major=prompt("请输入查询专业","");
				var url="http://localhost:8080/StuScoreSystem/Admin?method=lookoutScores&stuclass="+stuclass+"&major="+major;
				postrequest(url,funName);
			}
			
			function lastPage(){
				if(--pageNum==0){
					window.alert("已经是首页了");
					pageNum=1;
				}
				else{
					var url2="http://localhost:8080/StuScoreSystem/Admin?method=queryScoresbyPage&stuclass="+stuclass+"&major="+major+"&pageNum="+pageNum+"&amount=3"
					var funName=progress;
					postrequest(url2,funName);
				}
			}
			
			function nextPage(){
				if(((++pageNum)-1)*3>total_amount){
					window.alert("已经是最后一页了");
					pageNum--;
				}
				else{
					var url2="http://localhost:8080/StuScoreSystem/Admin?method=queryScoresbyPage&stuclass="+stuclass+"&major="+major+"&pageNum="+pageNum+"&amount=3"
					var funName=progress;
					postrequest(url2,funName);
				}
			}
	</script>

		<script>
			$(".sidebar-title").live('click', function() {
				if ($(this).parent(".sidebar-nav").hasClass("sidebar-nav-fold")) {
					$(this).next().slideDown(200);
					$(this).parent(".sidebar-nav").removeClass("sidebar-nav-fold");
				} else {
					$(this).next().slideUp(200);
					$(this).parent(".sidebar-nav").addClass("sidebar-nav-fold");
				}
			});
		</script>
	</body>

</html>